﻿using System;
using System.Collections.Generic;

namespace VerticalMenu
{
	public class CommandTableInfos
	{
		public List<TableInfos> TableInofList { get; set; }

		public List<string> Titles
		{
			get
			{
				List<string> list = new List<string>();
				foreach (TableInfos tableInfos in this.TableInofList)
				{
					list.Add(tableInfos.TableName);
				}
				return list;
			}
		}

		public CommandTableInfos()
		{
			this.TableInofList = new List<TableInfos>();
		}

		public CommandTableInfos(List<TableInfos> tableInofList)
		{
			this.TableInofList = tableInofList;
		}

		public CommandTableInfos(CommandTableInfos infos)
		{
			this.TableInofList = infos.TableInofList;
		}

		public bool GetCmdTabAndPanelName(string cmdName, ref string cmdText, ref string tabName, ref string panelName)
		{
			foreach (TableInfos tableInfos in this.TableInofList)
			{
				bool cmdPanelName = tableInfos.GetCmdPanelName(cmdName, ref cmdText, ref panelName);
				if (cmdPanelName)
				{
					tabName = tableInfos.TableName;
					return true;
				}
			}
			return false;
		}
	}
}
